// Created by Windward Studios - no copyright is claimed. This code can be used in
// any manner by anyone for any reason. There is no copyright of any kind on it. You may
// use it in commercial products. You may change it without sharing those changes.
// We ask that you keep the "created by Windward Studios" in a comment at the top.

using System;
using System.Text;
using net.windward.utils.ado.Access;
using net.windward.utils.ado.DB2;
using net.windward.utils.ado.Excel;
using net.windward.utils.ado.MySql;
using net.windward.utils.ado.ODBC;
using net.windward.utils.ado.OleDb;
using net.windward.utils.ado.Oracle;
using net.windward.utils.ado.PostgreSql;
using net.windward.utils.ado.SqlServer;
using NUnit.Framework;

namespace net.windward.utils.ado
{
	[TestFixture]
	public class TestProviderFactory
	{

		[Test]
		public void TestEnumProviders()
		{
			WrVendor[] providers = WrProviderFactories.GetAllProviders().Vendors;
			Assert.IsTrue(providers.Length >= 4);

			StringBuilder buf = new StringBuilder();
			if ((IntPtr.Size == 4) && (!new WrAccessVendor().IsInstalled))
				buf.Append("Access, ");
			if (!new WrDB2Vendor().IsInstalled)
				buf.Append("DB2, ");
			if (!new WrExcelVendor().IsInstalled)
				buf.Append("Excel, ");
			if (!new WrMySqlVendor().IsInstalled)
				buf.Append("MySql, ");
			if (!new WrOdbcVendor().IsInstalled)
				buf.Append("ODBC, ");
			if (!new WrOleDbVendor().IsInstalled)
				buf.Append("OleDb, ");
			if (!new WrOracleVendor().IsInstalled)
				buf.Append("Oracle, ");
			if (!new WrPostgreSqlVendor().IsInstalled)
				buf.Append("PostgreSQL, ");
			if (!new WrSqlServerVendor().IsInstalled)
				buf.Append("SqlServer, ");

			if (buf.Length > 0)
			{
				buf.Remove(buf.Length - 2, 2);
				Assert.Fail("The following connectors are not installed: " + buf);
			}
		}
	}
}
